package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.AppointmentRequest;
import one.stand.request.ProductsRequest;
import one.stand.request.ProductsTypeRequest;
import one.stand.response.AppointmentResponse;
import one.stand.response.ProductsResponse;
import one.stand.response.ProductsTypeResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 预约管理
 *
 * @author zrh
 */
@RestController
@RequestMapping("/products")
public class ProductsController extends BaseController {

    /**
     * 根据公司ID查询预约管理中预约列表数和产品管理数
     */
    @PostMapping("/getProductsCount")
    public ResultModel<Map<String, Object>> getProductsCount(@RequestBody AppointmentRequest request) {
        return productsService.getProductsCount(request);
    }

    /**
     * 查询公司预约商品类型（下拉框显示）
     */
    @PostMapping("/selectProductsTypeList")
    public ResultModel<List<ProductsTypeResponse>> selectProductsTypeList(@RequestBody ProductsTypeRequest request) {
        return productsService.selectProductsTypeList(request);
    }

    /**
     * 分页查询公司预约商品类型
     */
    @PostMapping("/selectProductsTypePage")
    public ResultModel<Map<String, Object>> selectProductsTypePage(@RequestBody ProductsTypeRequest request) {
        return productsService.selectProductsTypePage(request);
    }

    /**
     * 查询公司预约商品类型（包含类型下的商品信息）
     */
    @PostMapping("/selectProductsType")
    public ResultModel<List<ProductsTypeResponse>> selectProductsType(@RequestBody ProductsTypeRequest request) {
        return productsService.selectProductsType(request);
    }

    /**
     * 新增/修改预约商品类型
     */
    @PostMapping("/insertProductsType")
    public ResultModel<Boolean> insertProductsType(@RequestBody ProductsTypeRequest request) {
        return productsService.insertProductsType(request);
    }

    /**
     * 删除预约商品类型
     */
    @PostMapping("/delProductsType")
    public ResultModel<Boolean> delProductsType(@RequestBody ProductsTypeRequest request) {
        return productsService.delProductsType(request);
    }

    /**
     * 上移/下移商品类型
     */
    @PostMapping("/moveProductsType")
    public ResultModel<Boolean> moveProductsType(@RequestBody ProductsTypeRequest request) {
        return productsService.moveProductsType(request);
    }

    /**
     * 分页查询公司预约商品信息
     */
    @PostMapping("/selectProductsPage")
    public ResultModel<Map<String, Object>> selectProductsPage(@RequestBody ProductsRequest request) {
        return productsService.selectProductsPage(request);
    }

    /**
     * 查询公司预约商品信息
     */
    @PostMapping("/getProductsInfo")
    public ResultModel<ProductsResponse> getProductsInfo(@RequestBody ProductsRequest request) {
        return productsService.getProductsInfo(request);
    }

    /**
     * 新增/修改预约商品的信息
     */
    @PostMapping("/insertProducts")
    public ResultModel<Boolean> insertProducts(@RequestBody ProductsRequest request) {
        return productsService.insertProducts(request);
    }

    /**
     * 删除预约商品的信息
     */
    @PostMapping("/delProducts")
    public ResultModel<Boolean> delProducts(@RequestBody ProductsRequest request) {
        return productsService.delProducts(request);
    }

    /**
     * 上移/下移预约商品
     */
    @PostMapping("/moveProducts")
    public ResultModel<Boolean> moveProducts(@RequestBody ProductsRequest request) {
        return productsService.moveProducts(request);
    }

    /**
     * 分页查询预约列表
     */
    @PostMapping("/selectAppointmentPage")
    public ResultModel<Map<String, Object>> selectAppointmentPage(@RequestBody AppointmentRequest request) {
        return productsService.selectAppointmentPage(request);
    }

    /**
     * 查询预约列表详情
     */
    @PostMapping("/getAppointmentInfo")
    public ResultModel<AppointmentResponse> getAppointmentInfo(@RequestBody AppointmentRequest request) {
        return productsService.getAppointmentInfo(request);
    }

    /**
     * 新增预约订单
     */
    @PostMapping("/insertAppointment")
    public ResultModel<Boolean> insertAppointment(@RequestBody AppointmentRequest request) {
        return productsService.insertAppointment(request);
    }

    /**
     * 修改预约订单状态
     */
    @PostMapping("/updAppointmentState")
    public ResultModel<Boolean> updAppointmentState(@RequestBody AppointmentRequest request) {
        return productsService.updAppointmentState(request);
    }
}
